var a = require("../../@babel/runtime/helpers/interopRequireDefault"), e = a(require("../../utils/util")), t = a(require("../../utils/logs")),h = require("../../host"), o = getApp();

Page({
    data: {
        language: {},
        goodsData: [],
        bannerData: [ {
            thumb: ""
        } ],
        adPlace: [],
        params: {},
        memuData: [],
        indicatorDots: !0,
        vertical: !1,
        autoplay: !0,
        interval: 4e3,
        duration: 300,
        designerItem: [],
        isDesigner: !1,
        pageinfo: {},
        designer: "",
        readyshow: !1,
        defaultdata: "",
        last_page: "",
        isLoadMore: !1,
        page: 1,
        footshow: !1,
        fullShow: !1,
        popShow: !1,
        advertisement: {},
        bottomShowBol: !1,
        bottomShowBolIndex: 0,
        isWatch: !0,
        everyTime: !1,
        showNewcomerAward: !1,
        new_member_prize: {},
        page_id: 0,
        components: [],
        advertising: {},
        full_screen: {},
        top_info: {},
        bottom_info: {},
        mailInfo: {},
        clientWidth: "375",
        btnFlag: !1,
        foot_type: "",
        current_page: 1,
        total_page: 0,
        decorate_isLoadMore: !0,
        lastIndex: "",
        showPage: !0,
        showShare: !1,
        shareOptions: [ {
            name: "分享给好友",
            icon: "wechat",
            openType: "share"
        } ],
        goodshare_info: {},
        charityFundInfo: {
            show: !1,
            poster: ""
        },
        showDropdownMenu: !1,
        lotteryShareId: "",
        teamNameShow: !1,
        member_team_title: "",
        pageScrollTopV: 0
    },
    componentGoodShares: function(a) {
        a.detail && this.setData({
            goodshare_info: a.detail,
            showShare: !0
        });
    },
    componentMenuOpen: function(a) {
        this.setData({
            showDropdownMenu: a.detail
        });
    },
    componentMenuClose: function(a) {
        this.setData({
            showDropdownMenu: a.detail
        });
    },
    onClose: function() {
        this.setData({
            goodshare_info: {},
            showShare: !1
        });
    },
    onSelect: function() {
        this.setData({
            showShare: !1
        });
    },
    onShareTimeline: function() {
        var a = wx.getStorageSync("yz_uid"), e = "";
        a && (e = a);
        for (var t = {
            title: wx.getStorageSync("pageinfo").desc,
            query: "mid=".concat(e)
        }, o = 0; o < this.data.components.length; o++) "U_lottery" == this.data.components[o].component_key && (t.path = "/packageG/index/index?mid=" + e + "&lt=1");
        return t;
    },
    onShareAppMessage: function(a) {
        var e = wx.getStorageSync("yz_uid"), t = "";
        if (e && (t = e), a && "button" == a.from && "shareTag" == a.target.dataset.tag && "1" == a.target.dataset.item) {
            var i = "/packageB/member/group/GroupDetail/GroupDetail?id=" + a.target.dataset.info.id + "&mid=" + t, n = a.target.dataset.title;
            return a.target.dataset.store && (i = "/packageB/member/group/GroupDetail/GroupDetail?id=" + a.target.dataset.info.id + "store=" + a.target.dataset.store + "&mid=" + t), 
            1 == o.globalData.store_alone_temp && that.globalData.STORE_ID && (i = "".concat(i, "&store_alone_id=").concat(o.globalData.STORE_ID)), 
            {
                path: i,
                title: n
            };
        }
        var s = {
            title: wx.getStorageSync("pageinfo").title,
            path: "/packageG/index/index?mid=" + t
        };
        "{}" != JSON.stringify(this.data.goodshare_info) && "button" == a.from && (s.title = this.data.goodshare_info.name, 
        s.path = "/packageA/detail_v2/detail_v2?id=" + this.data.goodshare_info.id + "&mid=" + t, 
        s.imageUrl = this.data.goodshare_info.img), this.data.goodshare_info = {};
        for (var r = 0; r < this.data.components.length; r++) "U_lottery" == this.data.components[r].component_key && (s.path = "/packageG/index/index?mid=" + t + "&lt=1");
        return s;
    },
    onLoad:async function(a) {
        if (a && a.is_charity_fund && 1 == a.is_charity_fund && this.getCharityFundPoster(a.order_id), 
        wx.showShareMenu({
            withShareTicket: !1,
            menus: [ "shareAppMessage", "shareTimeline" ]
        }), 1 == wx.getStorageSync("address-status")) {
            var e = wx.getStorageSync("address-point");
            console.log(e, "有选择的地址");
        } else console.log("没有选择的地址就定位当前位置");
        if (a.scene) {
            var t = decodeURIComponent(a.scene);
            if (console.log(t, "21668"), t) {
                var i = [];
                i = t.split(",");
                for (var n = 0; n < i.length; n++) {
                    var s;
                    "mid" == (s = i[n].split("="))[0] && o._setMid(s[1]), "address_code" == s[0] && (o.data.address_code = s[1]);
                }
            }
        }
        try {
            var r = wx.getUpdateManager();
            r.onUpdateReady(function() {
                wx.showModal({
                    title: "更新提示",
                    content: "新版本已经准备好，是否重启应用？",
                    success: function(a) {
                        a.confirm && r.applyUpdate();
                    }
                });
            });
        } catch (a) {
            console.error(a);
        }
        a.mid && o._setMid(a.mid), 1 == a.lt && this.setData({
            lotteryShareId: a.mid
        });
        var d = wx.getStorageSync("new_decorate"), l = wx.getStorageSync("home_onUnload"), g = wx.getStorageSync("yz_basic_info");
        1 == l && d ? this._getOldData(d) : this._getData(), this.setData({
            mailInfo: g.home ? g.home.mailInfo : {},
            clientWidth: wx.getSystemInfoSync().windowWidth
        });
        // let de = wx.getStorageSync('yz_uid')
        // wx.getLocation({
        //     type:"wgs84",
        //     success(res){
        //         var t = o.getNetAddresss("Baoxian.getLocationByCoordinates");
        //         o._postNetWork({
        //             url: t,
        //             data:{
        //                 latitude:res.latitude,
        //                 longitude:res.longitude,
        //                 uid:de
        //             },
        //             success(l){
        //                 let i = l.data
        //                 if(i.result == 1){
        //                     wx.setStorageSync('areaData', JSON.stringify(i.data))
        //                 }
        //             }
        //         })
        //     },
        //     fail(err){
        //         console.log(err);
        //     }
        // })
        if(h.uniacid == "96"){
            wx.setStorageSync('hxtid', h.uniacid)
        }
        // 福祉
        if(h.uniacid == "103" && wx.getStorageSync('uid')){
            let res = await o._postNetWork({
                url: o.getNetAddresss("Fuzhi.isBox"),
                data:{
                    order_id:"",
                    uid:wx.getStorageSync('uid')
                },
            })
            if (1 == res.data.result && 1 == res.data.data) {
                wx.showModal({
                    content: '恭喜您成为云店店主,请完善您的云店信息',
                    showCancel:false,
                    complete: (res) => {
                      if (res.confirm) {
                          wx.navigateTo({
                            url: '/packageK/fuzhi/storeInfor/storeInfor',
                          })
                      }
                    }
                })
            }
        }

        
    },
    onReady: function() {
        var a = wx.getStorageSync("langIndex");
        this.setData({
            language: a.en
        });
    },
    onShow: function() {
        // 聚鑫判断
        this.getJuxinFugou()
    },
    onHide: function() {
        this.setData({
            showNewcomerAward: !1
        });
    },
    onUnload: function() {
        wx.setStorageSync("home_onUnload", 1);
    },
    onPullDownRefresh: function() {
        console.log("onPullDownRefresh", new Date()), wx.setStorageSync("popAdvertisement", !1), 
        this._getData();
    },
    onPageScroll: e.default.throttle(function(a) {
        var e = a[0];
        this.setData({
            pageScrollTopV: e.scrollTop
        }), e.scrollTop > 75 ? this.data.btnFlag || this.setData({
            btnFlag: !0
        }) : this.data.btnFlag && this.setData({
            btnFlag: !1
        }), this.data.bottomShowBol && this.setData({
            bottomShowBol: !1
        });
    }, 50),
    getCharityFundPoster: function(a) {
        var e = this, t = o.getNetAddresss("plugin.charity-fund.api.create_new_poster.createPoster");
        o._getNetWork({
            url: t,
            data: {
                order_id: a
            },
            success: function(a) {
                var t = a.data;
                1 == t.result && e.setData({
                    "charityFundInfo.show": !0,
                    "charityFundInfo.poster": t.data
                });
            }
        });
    },
    // 聚鑫91判断
    getJuxinFugou(){
        var e = this , i = o.getNetAddresss("Juxin.ninetyOne");
        o._getNetWork({
            url: i,
            success: function(i) {
                if(i.data.msg != 'success'){
                    wx.showModal({
                      content: i.data.msg,
                      complete: (res) => {
                        
                      }
                    })
                }
                // if(i.data.result == 1){
                //     console.log('判断',i.data.msg);
                // }
            }
        })
    },
    closeCharityFundPoster: function() {
        this.setData({
            "charityFundInfo.show": !1
        });
    },
    onReachBottom: function() {
        console.log("页面触底 onReachBottom"), this.data.defaultdata && (this.data.isLoadMore ? this.getMoreData() : console.log("没有更多数据")), 
        this.setData({
            bottomShowBol: !0
        }), console.log(this.data.bottomShowBol), this.data.decorate_isLoadMore && this.getMoreDecorate();
    },
    closeBtn: function() {
        this.setData({
            showNewcomerAward: !1
        });
        var a = wx.getStorageSync("popAdvertisement");
        this.data.advertising && this.data.advertising.id && !a && (wx.setStorageSync("popAdvertisement", !0), 
        this.setData({
            popShow: !0
        }));
        var e = wx.getStorageSync("storage_newAward");
        console.log("关闭新人奖弹窗======"), e && (e = null, wx.setStorageSync("storage_newAward", e)), 
        o._isTextEmpty(this.data.activityDatas.after_mini) || wx.redirectTo({
            url: this.data.activityDatas.after_mini
        });
    },
    initBalanceLang: function(a) {
        if (a && a.balance) try {
            wx.setStorageSync("balance", a.balance);
        } catch (a) {
            console.log(a);
        }
    },
    checkStoreAlone: function() {
        return 1 == o.globalData.store_alone_temp && (o.globalData.STORE_ID ? wx.reLaunch({
            url: "/packageG/independent_store/index/index?store_id=" + o.globalData.STORE_ID
        }) : wx.reLaunch({
            url: "/packageG/independent_store/access_tip/access_tip"
        }), !0);
    },
    _getOldData: function(a) {
        var e = this, i = this;
        if (!this.checkStoreAlone()) {
            wx.showLoading({
                title: "加载中"
            }), this.setData({
                showPage: !1
            }), i.setData({
                footshow: !0
            });
            var n = a.item, s = a.default;
            s && (i.setData({
                defaultdata: a.default,
                last_page: a.default.goods.last_page,
                isLoadMore: !1,
                page: 1
            }), i.setData({
                isLoadMore: i.data.last_page > 1
            }));
            var r = n.pageinfo ? n.pageinfo.params : {};
            if (i.setData({
                params: r,
                designer: a.designer ? a.designer : "",
                isWatch: 0 != r.allowauth
            }), !i.data.isWatch && n.page_info.member_level_url && n.page_info.member_level_url.link && n.page_info.member_level_url.link.indexOf("packageG/index/index") < 0 && wx.redirectTo({
                url: n.page_info.member_level_url.link
            }), console.log("会员是否可浏览装修页2", i.data.isWatch), "" != n.data && n.page_info && n.page_info.page_title ? (wx.setNavigationBarTitle({
                title: n.page_info.page_title ? n.page_info.page_title : i.data.mailInfo.name || ""
            }), wx.setStorageSync("pageinfo", {
                title: n.page_info.page_title ? n.page_info.page_title : i.data.mailInfo.name,
                desc: n.page_info.page_description
            })) : wx.setNavigationBarTitle({
                title: i.data.mailInfo.name || ""
            }), n.page_info && n.page_info.preview_color && wx.setNavigationBarColor({
                backgroundColor: n.page_info.preview_color,
                frontColor: 1 == n.page_info.font_color ? "#ffffff" : "#000000",
                animation: {
                    duration: 400,
                    timingFunc: "easeIn"
                }
            }), n.datas) {
                for (var d = 0; d < n.datas.length; d++) {
                    if ("U_newBlindBox" == n.datas[d].component_key) {
                        wx.redirectTo({
                            url: "/packageF/new_blind_box/index"
                        });
                        break;
                    }
                    "U_goods" == n.datas[d].component_key && (n.datas[d].index = d), "U_location" == n.datas[d].component_key && (n.datas[d].home = !0), 
                    "U_signin" == n.datas[d].component_key && (n.datas[d].host = o.data.host), n.datas[d].designer = i.data.designer;
                }
                i.setData({
                    isDesigner: !0,
                    decorate_isLoadMore: !0,
                    designerItem: n.datas,
                    page_id: n.id,
                    components: n.datas,
                    foot_type: n.foot_type
                }), n.page && i.setData({
                    total_page: n.page.total_page,
                    current_page: n.page.current_page,
                    bottomShowBolIndex: n.page.count - 1
                }), n.page_info && (i.setData({
                    advertising: n.page_info.advertising_id || {},
                    full_screen: n.page_info.full_screen_id || {}
                }), i.data.advertising.id && i.data.advertising.datas && (i.data.advertising.datas = JSON.parse(i.data.advertising.datas), 
                i.setData({
                    advertising: i.data.advertising
                }))), n.top && n.top.id && this.setData({
                    top_info: JSON.parse(n.top.page_info)
                }), -1 == n.foot_type ? this.setData({
                    bottom_info: {}
                }) : 1 == n.foot_type ? n.foot && n.foot.page_info ? this.setData({
                    bottom_info: JSON.parse(n.foot.page_info)
                }) : this.setData({
                    bottom_info: {}
                }) : 2 == n.foot_type && (n.foot instanceof Array ? this.setData({
                    bottom_info: {}
                }) : this.setData({
                    bottom_info: JSON.parse(n.foot.page_info)
                }));
                var l = wx.getStorageSync("fullAdvertisement");
                this.data.full_screen && this.data.full_screen.id && !l && 1 === this.data.full_screen.show_rule && (wx.setStorageSync("fullAdvertisement", !0), 
                this.setData({
                    fullShow: !0
                }), setTimeout(function() {
                    e.countDown(e.data.full_screen.show_time);
                }, 2e3));
                var g = wx.getStorageSync("fullAdvertisement_expiration"), c = parseInt(Date.parse(new Date()) / 1e3);
                if (this.data.full_screen && this.data.full_screen.id && 2 === this.data.full_screen.show_rule && g < c) {
                    var p = parseInt((new Date(new Date().toLocaleDateString()).getTime() + 864e5 - 1) / 1e3);
                    wx.setStorageSync("fullAdvertisement_expiration", p), this.setData({
                        fullShow: !0
                    }), setTimeout(function() {
                        e.countDown(e.data.full_screen.show_time);
                    }, 2e3);
                }
            } else {
                i.setData({
                    readyshow: !0
                });
                var _, f = s.category, m = f, h = Math.ceil(f.length / 10);
                wx.setStorageSync("pageinfo", {
                    title: i.data.mailInfo.name,
                    desc: i.data.mailInfo.name
                }), wx.setNavigationBarTitle({
                    title: i.data.mailInfo.name || ""
                }), _ = f.length <= 5 ? "in1" : "in2";
                for (var u = [], w = 0; w < h; w++) {
                    for (var v = [], D = 0; D < 10; D++) {
                        null != f[D] && v.push(f[D]);
                    }
                    f = m = m.slice(10), u.push(v);
                }
                i.setData({
                    bannerData: s.ads,
                    goodsData: s.goods,
                    memuData: u,
                    footshow: !0,
                    bottom_info: {},
                    menuHeightClass: _
                });
            }
            i.setData({
                showPage: !0
            }), wx.hideLoading();
            try {
                var S = wx.getStorageSync("storage_newAward");
                if (S && S.prize) {
                    var y = S, x = {}, b = y.activity;
                    x.type = y.activity.background_type, x.title = y.activity.title, x.awardlist = y.prize, 
                    0 == S.prize.length ? i.setData({
                        showNewcomerAward: !1
                    }) : (i.setData({
                        new_member_prize: x,
                        activityDatas: b
                    }), setTimeout(function() {
                        i.setData({
                            showNewcomerAward: !0
                        });
                    }, 200));
                } else {
                    var T = wx.getStorageSync("popAdvertisement");
                    this.data.advertising && this.data.advertising.id && !T && 1 === this.data.advertising.show_rule && (wx.setStorageSync("popAdvertisement", !0), 
                    this.setData({
                        popShow: !0
                    }));
                    var k = wx.getStorageSync("popAdvertisement_expiration"), A = parseInt(Date.parse(new Date()) / 1e3);
                    if (this.data.advertising && this.data.advertising.id && 2 === this.data.advertising.show_rule && k < A) {
                        var I = parseInt((new Date(new Date().toLocaleDateString()).getTime() + 864e5 - 1) / 1e3);
                        wx.setStorageSync("popAdvertisement_expiration", I), this.setData({
                            popShow: !0
                        });
                    }
                }
            } catch (a) {
                console.log("新人奖报错：：：", a);
            }
            try {
                var M = wx.getStorageSync("yz_basic_info");
                this.setData({
                    teamNameShow: !(!M.globalParameter || !M.globalParameter.member_team),
                    member_team_title: M.globalParameter && M.globalParameter.member_team ? M.globalParameter.member_team : ""
                }), this.address_codeMethod();
            } catch (a) {
                t.default.info("---------packageGindexindex.js 765------------", a);
            }
        }
    },
    _getData: function() {
        var a = this, e = this;
        if (!this.checkStoreAlone()) {
            var i = o.getNetAddresss("home-page.wxapp");
            wx.showLoading({
                title: "加载中"
            }), this.setData({
                showPage: !1
            }), o._getNetWork({
                url: i,
                success: function(i) {
                    i.data && i.data.basic_info && (e.initBalanceLang(i.data.basic_info.balance), a.setData({
                        mailInfo: i.data.basic_info.home ? i.data.basic_info.home.mailInfo : {}
                    }));
                    try {
                        if (i.data.basic_info) a.setData({
                            teamNameShow: !(!i.data.basic_info.globalParameter || !i.data.basic_info.globalParameter.member_team),
                            member_team_title: i.data.basic_info.globalParameter && i.data.basic_info.globalParameter.member_team ? i.data.basic_info.globalParameter.member_team : ""
                        }), a.address_codeMethod(i.data.basic_info); else {
                            a.address_codeMethod();
                            var n = wx.getStorageSync("yz_basic_info");
                            a.setData({
                                teamNameShow: !(!n.globalParameter || !n.globalParameter.member_team),
                                member_team_title: n.globalParameter && n.globalParameter.member_team ? n.globalParameter.member_team : ""
                            });
                        }
                    } catch (a) {
                        console.log(a), t.default.info("---------packageGindexindex.js 777------------", a);
                    }
                    if (wx.stopPullDownRefresh({
                        complete: function(a) {
                            console.log("关闭下拉刷新", a, new Date());
                        }
                    }), e.setData({
                        footshow: !0
                    }), i.data.data.item && 1 != o.globalData.store_alone_temp) try {
                        wx.setStorageSync("new_decorate", i.data.data);
                    } catch (a) {
                        console.log("数据过大真机会出现无法存储【#85269】", a);
                    }
                    var s = i.data.data.item, r = i.data.data.default;
                    r && (e.setData({
                        defaultdata: i.data.data.default,
                        last_page: i.data.data.default.goods.last_page,
                        isLoadMore: !1,
                        page: 1
                    }), e.setData({
                        isLoadMore: e.data.last_page > 1
                    }));
                    var d = s.pageinfo ? s.pageinfo.params : {};
                    if (e.setData({
                        params: d,
                        designer: i.data.data.designer ? i.data.data.designer : "",
                        isWatch: 0 != d.allowauth
                    }), !e.data.isWatch && s.page_info.member_level_url && s.page_info.member_level_url.link && s.page_info.member_level_url.link.indexOf("packageG/index/index") < 0 && wx.redirectTo({
                        url: s.page_info.member_level_url.link
                    }), console.log("会员是否可浏览装修页2", e.data.isWatch), "" != s.data && s.page_info && s.page_info.page_title ? (wx.setNavigationBarTitle({
                        title: s.page_info.page_title ? s.page_info.page_title : e.data.mailInfo.name || ""
                    }), wx.setStorageSync("pageinfo", {
                        title: s.page_info.page_title ? s.page_info.page_title : e.data.mailInfo.name,
                        desc: s.page_info.page_description
                    })) : wx.setNavigationBarTitle({
                        title: e.data.mailInfo.name || ""
                    }), s.page_info && s.page_info.preview_color && wx.setNavigationBarColor({
                        backgroundColor: s.page_info.preview_color,
                        frontColor: 1 == s.page_info.font_color ? "#ffffff" : "#000000",
                        animation: {
                            duration: 400,
                            timingFunc: "easeIn"
                        }
                    }), console.log(s.datas), s.datas) {
                        for (var l = 0; l < s.datas.length; l++) {
                            if ("U_newBlindBox" == s.datas[l].component_key) {
                                wx.redirectTo({
                                    url: "/packageF/new_blind_box/index"
                                });
                                break;
                            }
                            "U_goods" == s.datas[l].component_key && (s.datas[l].index = l), "U_location" == s.datas[l].component_key && (s.datas[l].home = !0), 
                            "U_signin" == s.datas[l].component_key && (s.datas[l].host = o.data.host), "U_couponStore" == s.datas[l].component_key && (s.datas[l].index = l), 
                            s.datas[l].designer = e.data.designer;
                        }
                        e.setData({
                            isDesigner: !0,
                            decorate_isLoadMore: !0,
                            designerItem: s.datas,
                            page_id: s.id,
                            components: s.datas,
                            foot_type: s.foot_type
                        }), s.page && e.setData({
                            total_page: s.page.total_page,
                            current_page: s.page.current_page,
                            bottomShowBolIndex: s.page.count - 1
                        }), s.page_info && (e.setData({
                            advertising: s.page_info.advertising_id || {},
                            full_screen: s.page_info.full_screen_id || {}
                        }), e.data.advertising.id && e.data.advertising.datas && (e.data.advertising.datas = JSON.parse(e.data.advertising.datas), 
                        e.setData({
                            advertising: e.data.advertising
                        }))), s.top && s.top.id && a.setData({
                            top_info: JSON.parse(s.top.page_info)
                        }), -1 == s.foot_type ? a.setData({
                            bottom_info: {}
                        }) : 1 == s.foot_type ? s.foot && s.foot.page_info ? a.setData({
                            bottom_info: JSON.parse(s.foot.page_info)
                        }) : a.setData({
                            bottom_info: {}
                        }) : 2 == s.foot_type && (s.foot instanceof Array ? a.setData({
                            bottom_info: {}
                        }) : a.setData({
                            bottom_info: JSON.parse(s.foot.page_info)
                        }));
                        var g = wx.getStorageSync("fullAdvertisement");
                        a.data.full_screen && a.data.full_screen.id && !g && 1 === a.data.full_screen.show_rule && (wx.setStorageSync("fullAdvertisement", !0), 
                        a.setData({
                            fullShow: !0
                        }), setTimeout(function() {
                            a.countDown(a.data.full_screen.show_time);
                        }, 2e3));
                        var c = wx.getStorageSync("fullAdvertisement_expiration"), p = parseInt(Date.parse(new Date()) / 1e3);
                        if (a.data.full_screen && a.data.full_screen.id && 2 === a.data.full_screen.show_rule && c < p) {
                            var _ = parseInt((new Date(new Date().toLocaleDateString()).getTime() + 864e5 - 1) / 1e3);
                            wx.setStorageSync("fullAdvertisement_expiration", _), a.setData({
                                fullShow: !0
                            }), setTimeout(function() {
                                a.countDown(a.data.full_screen.show_time);
                            }, 2e3);
                        }
                    } else {
                        e.setData({
                            readyshow: !0
                        });
                        var f, m = r.category, h = m, u = Math.ceil(m.length / 10);
                        wx.setStorageSync("pageinfo", {
                            title: e.data.mailInfo.name,
                            desc: e.data.mailInfo.name
                        }), wx.setNavigationBarTitle({
                            title: e.data.mailInfo.name || ""
                        }), f = m.length <= 5 ? "in1" : "in2";
                        for (var w = [], v = 0; v < u; v++) {
                            for (var D = [], S = 0; S < 10; S++) {
                                null != m[S] && D.push(m[S]);
                            }
                            m = h = h.slice(10), w.push(D);
                        }
                        e.setData({
                            footshow: !0,
                            bottom_info: {},
                            bannerData: r.ads,
                            goodsData: r.goods,
                            memuData: w,
                            menuHeightClass: f
                        });
                    }
                    e.setData({
                        showPage: !0
                    }), wx.hideLoading();
                    try {
                        var y = wx.getStorageSync("storage_newAward");
                        if (y && y.prize) {
                            var x = y, b = {}, T = x.activity;
                            b.type = x.activity.background_type, b.title = x.activity.title, b.awardlist = x.prize, 
                            0 == y.prize.length ? e.setData({
                                showNewcomerAward: !1
                            }) : (e.setData({
                                new_member_prize: b,
                                activityDatas: T
                            }), setTimeout(function() {
                                e.setData({
                                    showNewcomerAward: !0
                                });
                            }, 200));
                        } else {
                            var k = wx.getStorageSync("popAdvertisement");
                            a.data.advertising && a.data.advertising.id && !k && 1 === a.data.advertising.show_rule && (wx.setStorageSync("popAdvertisement", !0), 
                            a.setData({
                                popShow: !0
                            }));
                            var A = wx.getStorageSync("popAdvertisement_expiration"), I = parseInt(Date.parse(new Date()) / 1e3);
                            if (a.data.advertising && a.data.advertising.id && 2 === a.data.advertising.show_rule && A < I) {
                                var M = parseInt((new Date(new Date().toLocaleDateString()).getTime() + 864e5 - 1) / 1e3);
                                wx.setStorageSync("popAdvertisement_expiration", M), a.setData({
                                    popShow: !0
                                });
                            }
                        }
                    } catch (a) {
                        console.log("新人奖报错：：：", a);
                    }
                },
                fail: function(a) {
                    wx.stopPullDownRefresh({
                        complete: function(a) {
                            console.log("关闭下拉刷新", a, new Date());
                        }
                    });
                }
            });
        }
    },
    address_codeMethod: function() {
        var a = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : wx.getStorageSync("yz_basic_info");
        if (o.data.address_code) try {
            var e = a;
            if (e.plugin_setting.address_code && e.plugin_setting.address_code.enable) {
                var t = o.getNetAddresss("plugin.address-code.frontend.index.set-address");
                o._postNetWork({
                    url: t,
                    data: {
                        address_id: o.data.address_code
                    },
                    success: function(a) {
                        var e = a.data;
                        1 == e.result ? (console.log(e.data), o.data.address_code = "") : (0 == e.data.status && wx.reLaunch({
                            url: "/packageA/member/editmobile/editmobile?fromApp=1&is_code=1"
                        }), console.log(e.data.status, "1146"));
                    }
                });
            }
        } catch (a) {
            console.log(a);
        }
    },
    gotoBrand: function(a) {
        var e = a.currentTarget.dataset.item;
        wx.navigateTo({
            url: "/packageB/member/category/brandgoods/brandgoods?id=" + e.id
        });
    },
    gotoBrandV2: function() {
        wx.navigateTo({
            url: "/packageB/member/category/brand_v2/brand_v2"
        });
    },
    gotoTimeGood: function(a) {
        var e = a.currentTarget.dataset.item;
        wx.navigateTo({
            url: "/packageA/detail_v2/detail_v2?id=" + e.id
        });
    },
    gotoLimitedTimeGoods: function() {
        wx.navigateTo({
            url: "/packageG/limitedTimeGoods/limitedTimeGoods"
        });
    },
    getMoreDecorate: function() {
        var a = this;
        if (a.setData({
            decorate_isLoadMore: !1
        }), a.data.current_page < a.data.total_page) {
            a.setData({
                current_page: a.data.current_page + 1
            });
            var e = o.getNetAddresss("plugin.decorate.frotend.decorate-api.get-page");
            o._postNetWork({
                url: e,
                data: {
                    decorate_page: this.data.current_page,
                    decorate_id: this.data.page_id
                },
                success: function(e) {
                    var t = e.data;
                    1 == t.result ? a.setData({
                        decorate_isLoadMore: !0,
                        components: a.data.components.concat(t.data.datas)
                    }) : (a.setData({
                        decorate_isLoadMore: !1,
                        current_page: a.data.current_page - 1
                    }), console.log(t.msg));
                }
            });
        }
    },
    getAdvertise: function() {
        var a = this, e = o.getNetAddresss("member.member.getAdvertisement");
        o._getNetWork({
            url: e,
            success: function(e) {
                var t = e.data;
                1 == t.result ? t.data.advertisement && (a.setData({
                    advertisement: t.data.advertisement
                }), a.data.advertisement.switch && (1 === a.data.advertisement.rule ? a.data.everyTime || (a.setData({
                    fullShow: !0
                }), a.countDown(a.data.advertisement.time)) : (a.setData({
                    fullShow: !0,
                    everyTime: !0
                }), a.countDown(a.data.advertisement.time))), a.data.advertisement.Midswitch && (1 === a.data.advertisement.Midrule ? a.data.everyTime || a.setData({
                    popShow: !0
                }) : (console.log("弹窗每次登录"), a.setData({
                    popShow: !0,
                    everyTime: !0
                })))) : (console.log(t.msg, "该用户不是首次登录"), a.setData({
                    advertisement: t.data
                }), a.data.advertisement.switch && (1 === a.data.advertisement.rule ? (a.setData({
                    fullShow: !1
                }), a.countDown(a.data.advertisement.time)) : (a.setData({
                    fullShow: !0
                }), a.countDown(a.data.advertisement.time))), a.data.advertisement.Midswitch && (1 === a.data.advertisement.Midrule ? a.setData({
                    popShow: !1
                }) : a.setData({
                    popShow: !0
                })));
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    turnFullTo: function() {
        var a = this.data.full_screen.minapp_link;
        try {
            wx.navigateTo({
                url: a
            });
        } catch (a) {
            wx.showToast({
                title: "链接设置错误",
                icon: "none",
                duration: 2e3
            });
        }
    },
    turnTo: function() {
        if (2 == this.data.advertising.is_minapp) if (this.data.advertising.minapp_sid) if (this.data.advertising.minapp_link2) try {
            wx.navigateToMiniProgram({
                appId: this.data.advertising.minapp_sid,
                path: this.data.advertising.minapp_link2,
                extraData: {},
                envVersion: "release",
                success: function(a) {},
                fail: function(a) {
                    wx.showToast({
                        title: "小程序跳转失败",
                        icon: "none",
                        duration: 2e3
                    });
                }
            });
        } catch (a) {
            wx.showToast({
                title: "小程序跳转失败",
                icon: "none",
                duration: 2e3
            });
        } else wx.showToast({
            title: "请设置跳转小程序后的跳转链接",
            icon: "none",
            duration: 2e3
        }); else wx.showToast({
            title: "请设置小程序所需跳转appId",
            icon: "none",
            duration: 2e3
        }); else {
            var a = this.data.advertising.minapp_link;
            try {
                wx.navigateTo({
                    url: a
                });
            } catch (a) {
                wx.showToast({
                    title: "链接设置错误",
                    icon: "none",
                    duration: 2e3
                });
            }
        }
    },
    closePop: function() {
        this.setData({
            popShow: !1
        });
    },
    closeFull: function() {
        this.setData({
            fullShow: !1
        });
    },
    countDown: function(a) {
        var e = this, t = a;
        this.setData({
            "full_screen.show_time": t,
            "advertisement.time": t
        }), t--;
        var o = setTimeout(function() {
            t <= 0 ? (e.setData({
                fullShow: !1
            }), clearInterval(o)) : e.countDown(t);
        }, 1e3);
    },
    tel: function(a) {
        var e = a.currentTarget.dataset.telnum;
        wx.makePhoneCall({
            phoneNumber: e
        });
    },
    goToDetail: function(a) {
        var e = "/packageA/detail_v2/detail_v2?id=" + a.currentTarget.id;
        wx.navigateTo({
            url: e
        }), console.log(e);
    },
    goGoodsList: function(a) {
        var e = a.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/packageB/member/category/catelist/catelist?id=" + e
        });
    },
    clickADTo: function() {
        if (this.data.bannerData[0].small_link) {
            console.log("设置小程序跳转", this.data.bannerData[0].small_link);
            try {
                wx.navigateTo({
                    url: this.data.bannerData[0].small_link
                });
            } catch (a) {
                console.log(a);
            }
        }
    },
    clickADPlaceTo: function(a) {
        var e = a.currentTarget.dataset.link;
        if (console.log("设置小程序跳转", e), e) try {
            wx.navigateTo({
                url: e
            });
        } catch (a) {
            console.log(a);
        }
    },
    getMoreData: function() {
        var a = this;
        if (a.setData({
            isLoadMore: !1
        }), !(this.data.page >= this.data.last_page)) {
            a.setData({
                page: this.data.page + 1
            });
            var e = o.getNetAddresss("home-page.get-first-goods-page");
            o._getNetWork({
                url: e,
                data: {
                    page: a.data.page
                },
                success: function(e) {
                    var t = e.data;
                    if (1 == t.result) {
                        a.data.page >= a.data.last_page ? a.setData({
                            isLoadMore: !1
                        }) : a.setData({
                            isLoadMore: !0
                        });
                        var o = t.data.data;
                        a.setData({
                            "defaultdata.goods.data": a.data.defaultdata.goods.data.concat(o)
                        });
                    } else a.setData({
                        page: a.data.page - 1,
                        isLoadMore: !1
                    });
                },
                fail: function(a) {
                    console.log(a);
                }
            });
        }
    },
    gophone: function(a) {
        var e = a.currentTarget.dataset.num;
        wx.makePhoneCall({
            phoneNumber: e
        });
    }
});